// compare_int.rs

/// Comparison functions for pointers to integers.

/// Compare the integer values pointed at by two pointers to determine
/// if they are equal.
///
/// # Arguments
///
/// * `location1` - Pointer to the first value to compare.
/// * `location2` - Pointer to the second value to compare.
///
/// # Returns
///
/// Non-zero if the two values are equal, zero if the two values are not equal.
pub unsafe fn int_equal(location1: *const i32, location2: *const i32) -> bool {
    *location1 == *location2
}

/// Compare the integer values pointed at by two pointers.
///
/// # Arguments
///
/// * `location1` - Pointer to the first value to compare.
/// * `location2` - Pointer to the second value to compare.
///
/// # Returns
///
/// A negative value if the first value is less than the second value,
/// a positive value if the first value is greater than the second value,
/// zero if they are equal.
pub unsafe fn int_compare(location1: *const i32, location2: *const i32) -> i32 {
    let val1 = *location1;
    let val2 = *location2;

    if val1 < val2 {
        -1
    } else if val1 > val2 {
        1
    } else {
        0
    }
}
